<template>
  <div>
    <UserTopBar></UserTopBar>
    <UserIndexCategory :user="hToken"></UserIndexCategory>

    <router-view class="router-view"></router-view>
  </div>
</template>

<script>
  import UserTopBar from "./childComps/UserTopBar";
  import UserIndexCategory from "./childComps/UserIndexCategory";

  import {verToken} from 'common/utils'

  import {mapGetters} from "vuex";

  export default {
    name: "User",
    components: {
      UserIndexCategory,
      UserTopBar
    },
    data() {
      return {
        hToken:{
          username: '',
          business: 2,
        },
      }
    },
    computed: {
      ...mapGetters ({
        token: 'getToken'
      })
    },
    created() {
      if (this.token) {
        this.hToken.username = verToken(this.token).username
        this.hToken.business = verToken(this.token).business
      }
    },
  }
</script>

<style scoped>
  .router-view {
    position: absolute;
    top: 70px;
    left: 200px;

    width: 86.8%;
    /*background-color: red;*/
  }
</style>